package com.dream.testtubebaby.data;

import java.io.Serializable;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

//{"id":"17","doctorid":"100000001","fromtime":"2015-9-24","totime":"2015-9-27","stepname":"\u9a8c\u8840",
//"f_steptodo":"1","drug":"\u8fbe\u83f2\u6797","howmuch":"0.05mg","f_finished":"1","finishtime":"1442983337"}
public class AddToldData implements Serializable{
	private long id;
	private long doctorid;
	private String fromtime;
	private String totime;
	private String stepname;
	private int f_steptodo;
	private String drug;
	private String howmuch;
	private String[] attach;
	private int f_finished;
	private long finishtime;
	private String rightovary;
	private String leftovary;
	private String blood;
	private String feedback;
	
	public String getFeedback() {
		return feedback;
	}

	public void setFeedback(String feedback) {
		this.feedback = feedback;
	}

	public String[] getAttach() {
		return attach;
	}

	public void setAttach(String[] attach) {
		this.attach = attach;
	}

	public String getRightovary() {
		return rightovary;
	}

	public void setRightovary(String rightovary) {
		this.rightovary = rightovary;
	}

	public String getLeftovary() {
		return leftovary;
	}

	public void setLeftovary(String leftovary) {
		this.leftovary = leftovary;
	}

	public String getBlood() {
		return blood;
	}

	public void setBlood(String blood) {
		this.blood = blood;
	}

	public int getF_finished() {
		return f_finished;
	}

	public void setF_finished(int f_finished) {
		this.f_finished = f_finished;
	}

	public long getFinishtime() {
		return finishtime;
	}

	public void setFinishtime(long finishtime) {
		this.finishtime = finishtime;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getDoctorid() {
		return doctorid;
	}

	public void setDoctorid(long doctorid) {
		this.doctorid = doctorid;
	}

	public String getFromtime() {
		return fromtime;
	}

	public void setFromtime(String fromtime) {
		this.fromtime = fromtime;
	}

	public String getTotime() {
		return totime;
	}

	public void setTotime(String totime) {
		this.totime = totime;
	}

	public String getStepname() {
		return stepname;
	}

	public void setStepname(String stepname) {
		this.stepname = stepname;
	}

	public int getF_steptodo() {
		return f_steptodo;
	}

	public void setF_steptodo(int f_steptodo) {
		this.f_steptodo = f_steptodo;
	}

	public String getDrug() {
		return drug;
	}

	public void setDrug(String drug) {
		this.drug = drug;
	}

	public String getHowmuch() {
		return howmuch;
	}

	public void setHowmuch(String howmuch) {
		this.howmuch = howmuch;
	}
	//{"id":"1","doctorid":"100000021","fromtime":2015000,"totime":2015000,"stepname":"\u6253\u9488",
//	"f_steptodo":"1","drug":"\u8fbe\u83f2\u6797","howmuch":"0.05mg"}
	public static AddToldData getAddToldListNode(JSONObject jsonObject) {
		AddToldData addToldData = new AddToldData();
        long id = 0;
		try {
			id = jsonObject.getLong("id");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		long doctorid = 0;
		try {
			doctorid = jsonObject.getLong("doctorid");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		String fromtime = "";
		try {
			fromtime = jsonObject.getString("fromtime");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		String totime = "";
		try {
			totime = jsonObject.getString("totime");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		String stepname = "";
		try {
			stepname = jsonObject.getString("stepname");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		int f_steptodo = 0;
		try {
			f_steptodo = jsonObject.getInt("f_steptodo");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		String drug = "";
		try {
			drug = jsonObject.getString("drug");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		String howmuch = "";
		try {
			howmuch = jsonObject.getString("howmuch");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		int f_finished = 0;
		try {
			f_finished = jsonObject.getInt("f_finished");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		long finishtime = 0;
		try {
			finishtime = jsonObject.getLong("finishtime");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		String[] imgurl = null;
		try {
			JSONArray jsonBBS = new JSONArray(jsonObject.getString("attach"));
			imgurl = new String[jsonBBS.length()];
			for (int i = 0; i < jsonBBS.length(); i++) {
				String str = (String) jsonBBS.get(i);
				imgurl[i] = str;
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}

		String leftovary = null;
		try {
			leftovary = jsonObject.getString("leftovary");
		} catch (JSONException e1) {
			e1.printStackTrace();
		}

		String rightovary = null;
		try {
			rightovary = jsonObject.getString("rightovary");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		String blood = null;
		try {
			blood = jsonObject.getString("blood");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		String feedback = null;
		try {
			feedback = jsonObject.getString("feedback");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		addToldData.setId(id);
		addToldData.setDoctorid(doctorid);
		addToldData.setFromtime(fromtime);
		addToldData.setTotime(totime);
		addToldData.setStepname(stepname);
		addToldData.setDrug(drug);
		addToldData.setF_steptodo(f_steptodo);
		addToldData.setHowmuch(howmuch);
		addToldData.setF_finished(f_finished);
		addToldData.setFinishtime(finishtime);
		addToldData.setAttach(imgurl);
		addToldData.setLeftovary(leftovary);
		addToldData.setRightovary(rightovary);
		addToldData.setBlood(blood);
		addToldData.setFeedback(feedback);
		return addToldData;
	}
}
